package org.lingshi.common.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class BusException extends RuntimeException{
    private String message;
    private Integer code;

    public BusException(BusCodeEnum busCodeEnum){
        this.message = busCodeEnum.getMessage();
        this.code = busCodeEnum.getCode();
    }

    public static void busException(BusCodeEnum busCodeEnum){
        throw new BusException(busCodeEnum);
    }
}
